***********************************************************************************************************
**************************************** ICO-DMA Analysis ************************************************


clear all
*import ICO-DMA regression data 
import delimited "ico_dma_regressions.csv"

*label variable names
label variable ico_dma_svi "SVI"
label variable lot_sale_std "Lottery sales per capita"
label variable pop_std "Population"
label variable broadband_std "Broadband access"
label variable retention "Token retention (%)"
label variable kyc "KYC (0/1)"
label variable accelerated_pricing "Accelerated pricing (0/1)"
label variable platform "Platform (0/1)"
label variable pre_sale_dummy "Pre-sale (0/1)"
label variable white_paper_dummy "White paper (0/1)"
label variable github_dummy "GitHub presence (0/1)"
label variable team_dummy "Team (0/1)"
label variable cathprt_std "Catholic/Protestant ratio"
label variable med_income "Median income"
label variable inc_ineq "Income inequality"
label variable no_col "Non-college ratio"
label variable rural_urban "Rurality score"
label variable under_25 "Fraction < 25 years old"
label variable married "Married ratio"
label variable minority_ratio "Minority ratio"
label variable majority_male "Majority male"
label variable unemp "Unemployment rate"
label variable wallet_svi "ICO wallet SVI"
label variable cfpb_complaints_std "CFPB complaints (per 1000 population)"
label variable lib_vote_share "2016 election Libertarian party vote share"
label variable risk_taking_std "Regional risk-taking preferences"
label variable low_price_dummy "Low-ICO open price"
label variable postsg "Post--sports gambling legalization"
label variable bubble_ico "Bubble period token"


*only keep DMAs with non-zero lottery sales
keep if no_lottery != 1

*only keep DMAs with non-zero ICO attention
keep if ico_dma_svi > 0



***************************** Table 2, Panel A  *********************************

*column 1
eststo r1: reghdfe ico_dma_svi lot_sale_std, noabsorb vce(cluster ico_id dma_id)

estadd local ico_fe No
estadd local ico_control No
estadd local dma_control No

*column 2
eststo r2: reghdfe ico_dma_svi lot_sale_std pop_std broadband_std, noabsorb vce(cluster ico_id dma_id)

estadd local ico_fe No
estadd local ico_control No
estadd local dma_control Yes

*column 3
eststo r3: reghdfe ico_dma_svi lot_sale_std pop_std broadband_std retention kyc accelerated_pricing platform pre_sale_dummy white_paper_dummy github_dummy team_dummy, noabsorb vce(cluster ico_id dma_id)

estadd local ico_fe No
estadd local ico_control Yes
estadd local dma_control Yes

*column 4
eststo r4: reghdfe ico_dma_svi lot_sale_std pop_std broadband_std, absorb(ico_id) vce(cluster ico_id dma_id)

estadd local ico_fe Yes
estadd local ico_control No
estadd local dma_control Yes

*table output
esttab r1 r2 r3 r4, replace label se drop(_cons) stats(N ico_fe ico_control dma_control r2_a, fmt(%9.0g %9.3f) labels(N "ICO fixed effects" "ICO controls" "DMA controls" "Adj. R-squared"))  starlevels( * 0.10 ** 0.05 *** 0.010)


********************************* Table 3, Column 1 ****************************


*row 1: catholic/Protestant ratio
eststo r1: reghdfe ico_dma_svi cathprt_std pop_std broadband_std, absorb(ico_id) vce(cluster ico_id dma_id)

estadd local ico_fe Yes
estadd local dma_control Yes


*row 2: median income
eststo r2: reghdfe ico_dma_svi med_income pop_std broadband_std, absorb(ico_id) vce(cluster ico_id dma_id)

estadd local ico_fe Yes
estadd local dma_control Yes


*row 3: income inequality
eststo r3: reghdfe ico_dma_svi inc_ineq pop_std broadband_std, absorb(ico_id) vce(cluster ico_id dma_id)

estadd local ico_fe Yes
estadd local dma_control Yes


*row 4: non-college ratio
eststo r4: reghdfe ico_dma_svi no_col pop_std broadband_std, absorb(ico_id) vce(cluster ico_id dma_id)

estadd local ico_fe Yes
estadd local dma_control Yes


*row 5: rurality score
eststo r5: reghdfe ico_dma_svi rural_urban pop_std broadband_std, absorb(ico_id) vce(cluster ico_id dma_id)

estadd local ico_fe Yes
estadd local dma_control Yes


*rwo 6: fraction < 25 years old 
eststo r6: reghdfe ico_dma_svi under_25 pop_std broadband_std, absorb(ico_id) vce(cluster ico_id dma_id)

estadd local ico_fe Yes
estadd local dma_control Yes


*row 7: married ratio
eststo r7: reghdfe ico_dma_svi married pop_std broadband_std, absorb(ico_id) vce(cluster ico_id dma_id)

estadd local ico_fe Yes
estadd local dma_control Yes


*row 8: minority ratio
eststo r8: reghdfe ico_dma_svi minority_ratio pop_std broadband_std, absorb(ico_id) vce(cluster ico_id dma_id)

estadd local ico_fe Yes
estadd local dma_control Yes


*row 9: majority male dummy
eststo r9: reghdfe ico_dma_svi majority_male pop_std broadband_std, absorb(ico_id) vce(cluster ico_id dma_id)

estadd local ico_fe Yes
estadd local dma_control Yes


*row 10: unemployment rate
eststo r10: reghdfe ico_dma_svi unemp pop_std broadband_std, absorb(ico_id) vce(cluster ico_id dma_id)

estadd local ico_fe Yes
estadd local dma_control Yes


*table output
esttab r1 r2 r3 r4 r5 r6 r7 r8 r9 r10, replace label se drop(_cons pop_std broadband_std) stats(N ico_fe dma_control r2_a, fmt(%9.0g %9.3f) labels(N "ICO fixed effects" "DMA controls" "Adj. R-squared"))  starlevels( * 0.10 ** 0.05 *** 0.010)


********************************* Table 4, Column 1 ******************************
eststo r1: reghdfe wallet_svi lot_sale_std pop_std broadband_std, absorb(ico_id) vce(cluster ico_id dma_id)

estadd local ico_fe Yes
estadd local dma_control Yes

*column output
esttab r1, replace label se drop(_cons pop_std broadband_std) stats(N ico_fe dma_control r2_a, fmt(%9.0g %9.3f) labels(N "ICO fixed effects" "DMA controls" "Adj. R-squared"))  starlevels( * 0.10 ** 0.05 *** 0.010)


********************************* Table 5, Panel A ******************************

*column 1
eststo r1: reghdfe ico_dma_svi lot_sale_std pop_std broadband_std cfpb_complaints_std, absorb(ico_id)  vce(cluster ico_id dma_id)

estadd local ico_fe Yes
estadd local dma_control Yes


*column 2
eststo r2: reghdfe ico_dma_svi lot_sale_std pop_std broadband_std lib_vote_share, absorb(ico_id)  vce(cluster ico_id dma_id)

estadd local ico_fe Yes
estadd local dma_control Yes


*column 3
eststo r3: reghdfe ico_dma_svi lot_sale_std pop_std broadband_std risk_taking_std, absorb(ico_id)  vce(cluster ico_id dma_id)

estadd local ico_fe Yes
estadd local dma_control Yes


*table output
esttab r1 r2 r3, replace label se drop(_cons pop_std broadband_std) stats(N ico_fe dma_control r2_a, fmt(%9.0g %9.3f) labels(N "ICO fixed effects" "DMA controls" "Adj. R-squared"))  starlevels( * 0.10 ** 0.05 *** 0.010)


********************************* Table 6, Columns 1-3 ******************************

*column 1
eststo r1: reghdfe ico_dma_svi c.lot_sale_std##c.low_price_dummy pop_std broadband_std if hit_secondary == 1, absorb(ico_id) vce(cluster ico_id dma_id)
estadd local ico_fe Yes
estadd local dma_control Yes

*column 2
eststo r2: reghdfe ico_dma_svi c.lot_sale_std##c.kyc pop_std broadband_std, absorb(ico_id) vce(cluster ico_id dma_id)
estadd local ico_fe Yes
estadd local dma_control Yes

*column 3
eststo r3: reghdfe ico_dma_svi c.lot_sale_std##c.bubble_ico pop_std broadband_std, absorb(ico_id) vce(cluster ico_id dma_id)
estadd local ico_fe Yes
estadd local dma_control Yes


*columns output
esttab r1 r2 r3, replace label se drop(_cons low_price_dummy kyc pop_std broadband_std bubble_ico) stats(N ico_fe dma_control r2_a, fmt(%9.0g %9.3f) labels(N "ICO FE" "dma_controls" "Adj. R-squared"))  starlevels( * 0.10 ** 0.05 *** 0.010)




********************************* Table 7 ******************************


*column 1
eststo r1: reghdfe ico_dma_svi postsg pop_std broadband_std retention kyc accelerated_pricing platform pre_sale_dummy white_paper_dummy github_dummy team_dummy, absorb(dma_id ico_date) vce(cluster ico_id dma_id)
estadd local dma_fe Yes
estadd local date_fe Yes
estadd local ico_control Yes
estadd local ico_fe No


*column 2
eststo r2: reghdfe ico_dma_svi c.lot_sale_std##c.postsg pop_std broadband_std retention kyc accelerated_pricing platform pre_sale_dummy white_paper_dummy github_dummy team_dummy, absorb(ico_date dma_id) vce(cluster ico_id dma_id)
estadd local dma_fe Yes
estadd local date_fe Yes
estadd local ico_control Yes
estadd local ico_fe No


*column 3
eststo r3: reghdfe ico_dma_svi c.lot_sale_std##c.postsg pop_std broadband_std, absorb(ico_id dma_id) vce(cluster ico_id dma_id)
estadd local dma_fe Yes
estadd local date_fe No
estadd local ico_control No
estadd local ico_fe Yes


*table output
esttab r1 r2 r3, replace label se drop(_cons lot_sale_std pop_std broadband_std retention kyc accelerated_pricing platform pre_sale_dummy white_paper_dummy github_dummy team_dummy) stats(N dma_fe date_fe ico_control ico_fe r2_a, fmt(%9.0g %9.3f) labels(N "DMA fixed effects" "ICO-date fixed effects" "ICO controls" "ICO fixed effects" "Adj. R-squared"))  starlevels( * 0.10 ** 0.05 *** 0.010)